<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Linkage extends CI_Controller {
	
	function __construct(){
		parent::__construct();
	}
	
	public function get_option($type_id='',$selected=''){
		if(!intval($type_id)){
			$type_id = intval($this->input->post('type_id'));
		}
		if(!intval($selected)){
			$selected = intval($this->input->post('selected'));
		}
		
		$str = "<option value=''>请选择</option>";
		$this->load->model('Linkage_model', 'linkage');
		$list = $this->linkage->get_linkage_list($type_id);
		foreach($list as $key => $val){
			if($selected == $key){
				$str .= "<option value='".$key."' selected='selected'>".$val."</option>";
			}else{
				$str .= "<option value='".$key."'>".$val."</option>";
			}
		}
		echo $str;
	}
	
	
}